#include<iostream>
#include<cstring>
using namespace std;
const int N = 1e5 + 10, M = 4e5 + 10;
int h[N], e[M], ne[M], idx, w[M];
int p[N], dis[N];
int n, m, q;
int find(int x)
{
	if (x != p[x])p[x] = find(p[x]);
	return p[x];
}
struct node
{
	int a, b, w;
}S[M];

void add(int a, int b, int c)
{
	e[idx] = b, ne[idx] = h[a], w[idx] = c, h[a] = idx++;
}

void dfs(int u, int fa)
{
	for (int i = h[u]; ~i; i = ne[i]) {
		int j = e[i];
		if (j == fa)continue;
		dis[j] = dis[u] ^ w[i];
		dfs(j, u);
	}
}
int main()
{
	cin >> n >> m >> q;
	memset(h, -1, sizeof(h));
	for (int i = 1; i <= m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		S[i] = { a,b,c };
	}
	for (int i = 1; i <= n; i++)p[i] = i;
	for (int i = 1; i <= m; i++) {
		int a = S[i].a;
		int b = S[i].b;
		int a1 = find(a);
		int b1 = find(b);
		if (a1 != b1) {
			add(a, b, S[i].w);
			add(b, a, S[i].w);
			p[a1] = b1;
		}
	}

	dfs(1, 0);
	while (q--) {
		int a, b;
		cin >> a >> b;
		cout << (dis[a] ^ dis[b]) << endl;
	}
	return 0;
}